package com.htandroid.htandroid.webservice;

import com.htandroid.htandroid.entity.Htzc_Pvouchs;
import com.htandroid.htandroid.entity.UffjqgdList_detail;
import com.htandroid.htandroid.sys.Basenvo;

import java.util.ArrayList;

//生成xml的文本信息
public class BuildHtzcPvouchsXMLService {

    public String buildXML(ArrayList<Htzc_Pvouchs> zcpdslist, String methodName, String namespace, String[] param, String[] val, String param_o) {
        String xmlstring = "<?xml version=\"1.0\" encoding=\"utf-8\"?><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><soap:Body>";
        //添加方法名
        xmlstring = xmlstring + "<" + methodName + " xmlns=\"" + namespace + "\"> \r\n";
        //前参
        for (int i = 0; i < param.length; i++) {
            xmlstring = xmlstring + "<" + param[i] + ">" + val[i] + "</" + param[i] + "> \r\n";
        }
        if (zcpdslist != null) {
            //对象参数
            xmlstring = xmlstring + "<" + param_o + ">\r\n";
            for (int i = 0; i < zcpdslist.size(); i++) {
                Htzc_Pvouchs zcpds = zcpdslist.get(i);
                xmlstring = xmlstring + "<Htzc_Pvouchs xmlns=\"http://entity.test.com\">\r\n";//必须指定映射文件所在的路径,否则webservice默认的是当前路径
                xmlstring = xmlstring + "<autoid>" + Basenvo.AdjDigest(zcpds.getAutoid()) + "</autoid>\r\n";
                xmlstring = xmlstring + "<creason>" + Basenvo.AdjDigest(zcpds.getCreason()) + "</creason>\r\n";
                xmlstring = xmlstring + "<cuser>" + Basenvo.AdjDigest(zcpds.getCuser()) + "</cuser>\r\n";
                xmlstring = xmlstring + "<cvouchid>" + Basenvo.AdjDigest(zcpds.getCvouchid()) + "</cvouchid>\r\n";
                xmlstring = xmlstring + "<dblvalue>" + Basenvo.AdjDigest(zcpds.getDblvalue()) + "</dblvalue>\r\n";
                xmlstring = xmlstring + "<dpdate>" + Basenvo.AdjDigest(zcpds.getDpdate()) + "</dpdate>\r\n";
                xmlstring = xmlstring + "<isup>" + Basenvo.AdjDigest(zcpds.getIsup()) + "</isup>\r\n";
                xmlstring = xmlstring + "<lbuildnum>" + Basenvo.AdjDigest(zcpds.getLbuildnum()) + "</lbuildnum>\r\n";
                xmlstring = xmlstring + "<ldiffnum>" + Basenvo.AdjDigest(zcpds.getLdiffnum()) + "</ldiffnum>\r\n";
                xmlstring = xmlstring + "<lnum>" + Basenvo.AdjDigest(zcpds.getLnum()) + "</lnum>\r\n";
                xmlstring = xmlstring + "<sStyle>" + Basenvo.AdjDigest(zcpds.getsStyle()) + "</sStyle>\r\n";
                xmlstring = xmlstring + "<sassetname>" + Basenvo.AdjDigest(zcpds.getSassetname()) + "</sassetname>\r\n";
                xmlstring = xmlstring + "<sassetnum>" + Basenvo.AdjDigest(zcpds.getSassetnum()) + "</sassetnum>\r\n";
                xmlstring = xmlstring + "<scardnum>" + Basenvo.AdjDigest(zcpds.getScardnum()) + "</scardnum>\r\n";
                xmlstring = xmlstring + "<sdeptname>" + Basenvo.AdjDigest(zcpds.getSdeptname()) + "</sdeptname>\r\n";
                xmlstring = xmlstring + "<sdeptnum>" + Basenvo.AdjDigest(zcpds.getSdeptnum()) + "</sdeptnum>\r\n";
                xmlstring = xmlstring + "<ssite>" + Basenvo.AdjDigest(zcpds.getSsite()) + "</ssite>\r\n";
                xmlstring = xmlstring + "<succount>" + Basenvo.AdjDigest(zcpds.getSuccount()) + "</succount>\r\n";
                xmlstring = xmlstring + "<zccheckeddate>" + Basenvo.AdjDigest(zcpds.getZccheckeddate()) + "</zccheckeddate>\r\n";
                xmlstring = xmlstring + "<zccheckedname>" + Basenvo.AdjDigest(zcpds.getZccheckedname()) + "</zccheckedname>\r\n";
                xmlstring = xmlstring + "</Htzc_Pvouchs>\r\n";
            }
            xmlstring = xmlstring + "</" + param_o + ">\r\n";
        }
        xmlstring = xmlstring + "</" + methodName + ">\r\n";
        xmlstring = xmlstring + "</soap:Body></soap:Envelope>";
        return xmlstring;
    }
}
